home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000085_icon-group-sender _Fri Mar 14 12:27:18 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Sat, 15 Mar 1997 05:54:42 MST
  2. Message-Id: <1.5.4.32.19970314182718.006f6888@post.its.mcw.edu>
  3. X-Sender: cdt@post.its.mcw.edu
  4. X-Mailer: Windows Eudora Light Version 1.5.4 (32)
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset="us-ascii"
  7. Date: Fri, 14 Mar 1997 12:27:18 -0600
  8. To: "Dave Schaumann" <dschauma@csci.csc.com>, icon-group@cs.arizona.edu
  9. From: Chris Tenaglia <cdt@post.its.mcw.edu>
  10. Subject: Re: Recursive directory traversal in Icon
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: RO
  13. Content-Length: 1816
  14.  
  15. Traverse a hierarchical directory structure?
  16. Less theory, more samples. How about :
  17.  
  18. produre dirtrace()
  19.   command := "ls -alR"
  20.   info := open(command,"pr")
  21.   while crunch(read(info))
  22.   close(info)
  23.   end
  24.  
  25. procedure crunch(file)
  26.   ... do something with the files ...
  27.   end
  28.  
  29. I suppose you can modify the ls command to
  30. focus the search, or repackage it using the
  31. unix find command.
  32.  
  33. In the MSDOS world you might try something
  34. like :
  35.  
  36. procedure dirtrace()
  37.   command := "DIR/S C:\\ >XXX.XXX"
  38.   system(command)
  39.   info := open("C:\\XXX.XXX")
  40.   while crunch(read(info))
  41.   close(info)
  42.   end
  43.  
  44. procedure crunch(file)
  45.   ... do something with the files ...
  46.   end
  47.  
  48. Chris.
  49.  
  50. At 06:35 PM 3/10/97 GMT, Dave Schaumann wrote:
  51. >
  52. >
  53. >Brian Rogoff <bpr@best.com> wrote in article
  54. ><Pine.SGI.3.95.970305103012.2721A-100000@shellx.best.com>...
  55. >> Hi,
  56. >>     I've been reading the Icon web references, trying to decide if I 
  57. >> should forsake Perl in favor of Icon, and I have two questions.
  58. >> 
  59. >> (1) How do I traverse a hierarchical directory structure in Icon? I found
  60. >
  61. >>     chdir, but I didn't find the equivalent of 'ls' and 'stat'. Is there 
  62. >>     a way to do this in Icon, or do you rely on the external environment?
  63. >
  64. >This is one of the biggest weaknessess of Icon, especially wrt languages
  65. >like Perl -- the support for access to the OS is highly limited.  The file
  66. >IO system works pretty good, as does the extension to X.  But other than
  67. >that, about all that's available is system() and popen() (which may or may
  68. >not have a reasonable analog available on non-Un*x systems).
  69. >
  70.  
  71. Chris Tenaglia (system manager)         |       cdt@post.its.mcw.edu
  72. Medical College of Wisconsin            |
  73. 8701 W. Watertown Plank Rd.             |      Ce que vous voyez est
  74. Milwaukee, WI 53226 (414)456-8765       |      Ce que vous obtenez !
  75.  
  76.